Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Support Arrays in browserify conf #280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dasilvacontin
Copy link

Before, exclude and ignore would not accept an Array of paths since
Browserify.prototype.exclude/ignore was expecting a single file as
argument.

Need to check if this change breaks behaviour for other browserify opts
that do accept or expect an Array as arg.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @rase-, @vvo and @bevacqua to be potential reviewers

@@ -39,7 +39,11 @@ function configure(bundler, cfg) {
if (type === 'transform' && typeof o[type] === 'object') {
bundler[type](o[type].name, _.omit(o[type], 'name'));
} else {
bundler[type](o[type], _.omit(o, type));
var values = o[type];
if (!Array.isArray(values)) values = [values];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing { } for if statement body

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

`exclude` and `ignore` would not accept an Array of paths before, since
`Browserify.prototype.exclude/ignore` was expecting a single file as
argument.
@dasilvacontin
Copy link
Author

Please double check if the change does not break some other option that only accepts an array, since I didn't check it myself.

@defunctzombie
Copy link
Owner

@dasilvacontin please check that or better yet write a test for this.

@dasilvacontin
Copy link
Author

  • Browserify.prototype.plugin accepts a single function/plugin per invocation. If invoked using an array, the first element is the function/plugin, and the second element is the opts object.

    This means zuul doesn't currently support the definition of multiple browserify plugins via zuul.yml, and that my change-set is a breaking change for people that specify a plugin and its opts using an array, even if my change-set would effectively add support for definition of multiple browserify plugins.

    A solution could be – in case of being provided an array – to check if the type of the second element in the array is an object.

(gotta go, will investigate the others later)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants